package com.x.epspace.entity;

import java.io.Serializable;

import org.bson.types.ObjectId;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.mongodb.morphia.annotations.Id;


public abstract class BaseEntity  {
	@Id
	@JsonIgnore
	private ObjectId oid;
	
	public ObjectId getOid() {
		return oid;
	}

	public void setOid(ObjectId oid) {
		this.oid = oid;
	}
	
	public String get_id(){
		return oid.toString();
	}
	
	public boolean equals(Object obj){
		if(obj == null) return false;
		BaseEntity objEntity = (BaseEntity)obj;
		if(objEntity.get_id().equals(this.get_id())){
			return true;
		}else{
			return false;
		}
		
	}
	
	public int hashCode() {
		if(oid == null) return 0;
		return oid.hashCode();
	}
	
}
